package com.baliejun.springsell.service.impl;

import com.baliejun.springsell.bean.ProductCategory;
import com.baliejun.springsell.dao.ProductCategoryDao;
import com.baliejun.springsell.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;


/**
 * @Author: LiejunBa
 * @Description:类目service实现
 * @Date: 2020/12/2 2:18 下午
 */
@Service
public class ProductCategoryServiceImpl implements ProductCategoryService {

    @Autowired
    private ProductCategoryDao dao;

    @Override
    public ProductCategory findOne(Integer categoryId) {

       //查到返回对象，查不到返回null
        return dao.findById(categoryId).orElse(null);

    }

    @Override
    public List<ProductCategory> findAll() {

        return dao.findAll();
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {
        return dao.findByCategoryTypeIn(categoryTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return dao.save(productCategory);
    }


}
